﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Model
{
    [ObjectEvent]
    public class RM_003Event : ObjectEvent<RM_003>, IAwake
    {
        public void Awake()
        {
            Get().Awake();
        }
    }
    public class RM_003 : BattleEventComponent
    {
        public override BattleEventType[] EventType { get; set; } = new BattleEventType[] { BattleEventType.TakeAttack };

        public override bool IfTrap { get; set; } = true;

        public override async Task RunEvent(BattleEventType eventType, FightModel fightModel, params object[] param)
        {
            DamageInfo damageInfo = param[0] as DamageInfo;
            BattleCard card = GetEntity<BattleCard>();
            if (card.CardPlace != CardPlace.Equip)
            {
                return;
            }
            if (damageInfo.AttackCard.Owner != card.Owner)//对方攻击宣言的场合
            {
                DecideInfo decideInfo = new DecideInfo()
                {
                    Describe = "是否使用[梦符「梦想亚空穴」]",
                    CallBack = () =>
                    {
                        damageInfo.AttackCard.AddComponent<RM_003Effect>();
                    },                    
                };
                await BattleEventWatcherComponent.Single.RunEvent(BattleEventType.ShowWindow, fightModel, WindowType.Ask, decideInfo);
            }
        }
    }
}
